//
//  BaseViewController.m
//  KYProject
//
//  Created by Mxxx on 2016/12/20.
//  Copyright © 2016年 Roman. All rights reserved.
//

#import "BaseViewController.h"
#import "UIViewController+JASidePanel.h"

@interface BaseViewController ()
@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.barTintColor = [UIColor grayColor];
    [self setUpLeftButtonItem];
}

//修改左上角item
- (void)setUpLeftButtonItem
{
    UIButton *leftBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 40)];
    [leftBtn setImage:[UIImage imageNamed:@"JianTou"] forState:UIControlStateNormal];
    [leftBtn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:leftBtn];
}
//想任意跳转,就重写goBack方法
- (void)goBack
{
    [self.navigationController popViewControllerAnimated:YES];
}
//侧滑
/** 中间的nav */
- (UINavigationController *)centerNavigationController
{

   return (UINavigationController *)self.sidePanelController.centerPanel;
   

}

/** 左侧VC */
- (UIViewController *)leftMenuViewController
{
    return self.sidePanelController.leftPanel;
}


- (void)jumpToOtherViewController:(UIViewController *)otherVC
{
    //显示中间的panel
    [self.sidePanelController showCenterPanelAnimated:YES];
    
    //push 到指定的VC
    [[self centerNavigationController] pushViewController:otherVC animated:NO];
    
}
@end
